local Util = {}

-- 用于多选的 interaction type ，修改自askToChoices，
-- 限制"最少选择项数"需要在函数（如feasible）中判断(self.interaction.data and #self.interaction.data > min_num)
--
-- 可以赋值的属性有：
-- * choices: string[]，可选选项
-- * default: string[]，默认选项，默认为空
-- * detailed: bool，为真的话送详细信息
-- * all_choices: string[] 类型，保存着所有选项，会被前端翻译
-- * max_num: integer，最多选择项数，至多为#choices，默认为1
Util.CheckBox = function(spec)
  spec.choices = type(spec.choices) == "table" and spec.choices or Util.DummyTable
  spec.all_choices = type(spec.all_choices) == "table" and spec.all_choices or spec.choices
  spec.default_choice = spec.default_choice or {}
  spec.detailed = spec.detailed or false
  spec.type = "custom"
  spec.max_num = spec.max_num and math.min(spec.max_num,#spec.choices) or 1
  spec.qml_path = "packages/sanshe/qml/SkillCheckBox"
  return spec
end

return Util
